﻿using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JoeyLibs.Utility.Log
{
    /// <summary>
    /// 导致毁灭性的日志实体
    /// </summary>
    public class FatalLogModel : LogModel
    {
        private Exception exception;
        /// <summary>
        /// 相关异常对象（如果存在）
        /// </summary>
        public Exception Exception
        {
            get { return exception; }
            set { this.exception = value; }
        }

        protected override ILog Log
        {
            get
            {
                return GetLogger("FatalLogger");
            }
        }

        public FatalLogModel(string message = "", string reason = "", string solution = "", Exception exception = null)
            : base(message)
        {
            base.Reason = reason;
            base.Solution = solution;
            this.exception = exception;
        }

        public override void Output()
        {
            Log.Fatal(LogUtility.GetLogMessage(this), exception);
        }
    }
}
